#######################################################################################################################################
## BB-код: ModernThumb                                                                                                               ##
## Автор мода: DimaUZB2001                                                                                                           ##
## Версия мода: 1.0                                                                                                                  ##
## Описание: Добавляет вв-код уменьшенного изображения, при клике по которому открывается просмотр в режиме слайдшоу с затемнением.  ##
#######################################################################################################################################

----------------------------------------------------------------------------------------------------------
---------------------- Открыть library/includes/bbcode.php и Найти ---------------------------------------

// Image

---------------------- Перед вставить --------------------------------------------------------------------

// ModernThumb
$bbcode_tpl['thumb'] = <<<HTML
<a href="\\1" class="modern-thumb">
    <img src="\\1" alt="Эскиз" class="modern-img">
</a>
HTML;

----------------------------------------------------------------------------------------------------------
---------------------- Открыть src/Legacy/BBCode.php и Найти ---------------------------------------------

'#\[font="([\w\- \']+)"\]#isu' => '<span style="font-family: $1;">',

---------------------- После вставить --------------------------------------------------------------------

"#\[thumb\]($img_exp)\[/thumb\]\s*#i" => $tpl['thumb'],

----------------------------------------------------------------------------------------------------------
---------------------- Открыть language/ru/main.php и Самый внизу вставить -------------------------------

$lang['THUMB'] = 'Thumb';
$lang['THUMB_TITLE'] = 'Миниатюра: [thumb]http://image_url[/thumb]';

----------------------------------------------------------------------------------------------------------
---------------------- Открыть styles/templates/default/page_header.tpl и Найти --------------------------

<!-- IF INCLUDE_BBCODE_JS -->

---------------------- Перед вставить --------------------------------------------------------------------

<!-- Модалка -->
<div id="thumbModal">
    <span id="arrowPrev" class="modal-arrow">&#10094;</span>
    <div id="thumbModalContent">
        <img id="thumbModalMain" alt="">
    </div>
    <span id="arrowNext" class="modal-arrow">&#10095;</span>
</div>

<script type="text/javascript" src="{SITE_URL}styles/js/modernthumb.js"></script>

----------------------------------------------------------------------------------------------------------
---------------------- Открыть styles/templates/default/posting_editor.tpl и Найти -----------------------

<input type="button" value="{L_SPOILER}" name="codeSpoiler" title="{L_SPOILER}" style="width: 65px;" />

---------------------- После вставить --------------------------------------------------------------------

<input type="button" value="{L_THUMB}" name="codeThumb" title="{L_THUMB_TITLE}" style="width: 76px" />

-------------------------- Найти -------------------------------------------------------------------------

bbcode.addTag("codeSpoiler", "spoiler", null, "",  ctrl);

---------------------- После вставить --------------------------------------------------------------------

bbcode.addTag("codeThumb", "thumb", null, "", ctrl);

----------------------------------------------------------------------------------------------------------
---------------------- Открыть styles/templates/default/css/globals.css и Самый внизу вставить -----------

/* =========================
   MODERNTHUMB
   ========================= */
.modern-thumb {
  display: inline-block;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  max-width: 180px;
  max-height: 100px;
  border: 2px solid silver;
  margin: 3px;
  cursor: pointer;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12),
              0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.3s ease,
              filter 0.3s ease;
}

.modern-thumb::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
  z-index: 1;
}

.modern-thumb:hover::before {
  left: 100%;
}

.modern-thumb:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 12px 40px rgba(0, 70, 100, 0.2),
              0 0 0 1px rgba(255, 255, 255, 0.1);
  filter: saturate(1.1);
}

/* Image inside thumb */
.modern-thumb img {
  display: block;
  width: 200px;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 0.3s ease;
  filter: contrast(1.05) brightness(1.02);
}

.modern-thumb:hover img {
  transform: scale(1.08);
}

/* Overlay text */
.modern-thumb .overlay-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: linear-gradient(45deg, rgba(25,118,210,0.85), rgba(56,152,248,0.85));
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 50px;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transition: all 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.modern-thumb:hover .overlay-text {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* =========================
   MODAL
   ========================= */
#thumbModal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(circle, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.4) 100%);
  backdrop-filter: blur(0px) brightness(0.8);
  transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
  z-index: 9999;
}

#thumbModal.show {
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(12px) brightness(0.8);
}

/* Main image */
#thumbModal img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.6),
              0 0 0 1px rgba(255,255,255,0.08);
  transition: transform 0.3s ease, opacity 0.3s ease;
  object-fit: contain;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(2px);
  cursor: zoom-in;
}

/* =========================
   MODAL ARROWS
   ========================= */
.modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(1);
  font-size: 36px;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
  padding: 15px;
  border-radius: 50%;
  background: rgba(25,118,210,0.2);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.15);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
}

.modal-arrow:hover {
  color: #fff;
  background: rgba(56,152,248,0.4);
  transform: translateY(-50%) scale(1.15);
  box-shadow: 0 0 20px rgba(56,152,248,0.4);
}

#arrowPrev { left: 20px; }
#arrowNext { right: 20px; }

/* =========================
   RESOLUTION & COUNTER
   ========================= */
.modal-counter,
.modal-resolution {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.35);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  backdrop-filter: blur(4px);
  z-index: 10000;
  transition: opacity 0.3s ease;
}

.modal-counter { margin-bottom: 40px; }
.modal-resolution { margin-bottom: 70px; }

/* =========================
   CURSOR & ZOOM EFFECT
   ========================= */
#thumbModal img.zoomed {
  cursor: grab;
}

#thumbModal img:active.zoomed {
  cursor: grabbing;
}









